<% @options.each do |action_type, options| %>
  <% options.each do |k,v| %>
    <% if v.length > 0 %>
      <h5><%= k.titleize %></h5>
    <% end %>
    <%= fields_for "options[#{action_type}][#{k}]", OpenStruct.new({}) do |options_form| %>
      <% v.each do |key, value| %>
        <div class="field">
        
          <% if value[:value].blank? || value[:user_specified] ==true %>            
            <%= render partial: value["type"] ? "shared/workflowable/fields/#{value["type"]}" : "shared/workflowable/fields/string", locals: {f: options_form, label:value.try(:[],:name) || key, value_hash:value, value: params.try(:[], action_type).try(:[],k).try(:[],key) || value[:value] ||  value[:default], key:key, workflow_id: @flag.workflow_id, action_id:k} %>
          <% else %>
            <!-- <b><%= key.to_s.titleize %>: </b>
              <%#= value.try(:[],:value).try(:[],:name) if value.try(:[],:value).class == ActionController::Parameters %>
              <%#= value.try(:[],:value) if value.try(:[],:value).class != ActionController::Parameters %> -->
          <% end %>
        </div>
      <% end %>
    <% end %>
  <% end %>
<% end %>
